home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln0185.arc / MACPRO.LTG < prev    next >
Text File  |  1986-10-01  |  5KB  |  112 lines

  1.  
  2.                         MACRO FORMAT 
  3.  
  4. ;testmac.asm     A format for testing MACROS
  5. ;the format uses a COM file type since the byte size of the file
  6. ;as displayed by the 'directory' reflects just the assembled code
  7. ;must use exe2bin after obtaining the EXE file to get COM file
  8. ;
  9. ; ENTEZ MACROS in this section
  10. ;
  11. service    macro   fn,in       ;call for function # and 
  12.          mov     ah,fn       ;interrupt #. Can be used
  13.          int     in          ;for either ROMBIOS or DOS
  14.          endm                ;End Macro,4 bytes of code when invoked
  15. ;
  16. chrtoscr    mac   chr         ;display chr on screen
  17.         mol    ;DOS use only
  18.         se,   ;function 2, INT 21h for DOS
  19.          e      ;End Macro,6 bytes of code when invoked
  20. ;
  21. crlf     macro               ;carriage return,linefeed
  22.          chrtoscr 13         ;carriage return
  23.          chrtoscr 10         ;line feed
  24.          endm                ;End macro,12 bytes of code when invoked
  25. ;
  26. ;Start of actual code section
  27. ;
  28. codeseg  segment             ;start of codeseg,pseudo-op
  29. assume   cs:codeseg          ;define code segment,pseudo-op
  30.          org 100h            ;required for COM, pseudo-op
  31. ;
  32. begin:                       ;actual code below,'begin' is label
  33.          chrtoscr 49         ;print ASCII 49 on screen(1),6 bytes
  34.          crlf                ;carriage return,linefeed,  12 bytes
  35.          chrtoscr 50         ;print ASCII 50 on screen(2),6 bytes
  36. ;
  37.          service  4ch,21h    ;return to DOS,see E-3 of DOS 2.0 Manual
  38.                              ;4 bytes
  39. codeseg  ends                ;end of codeseg,pseudo-op
  40.          end      begin      ;where to start,pseudo-op
  41. ;
  42. ;Fini                        ;24 bytes of executable code in macros
  43.                              ; 4 bytes of executable code in DOS rtn
  44. ;Total Executable Code is 28 bytes as portrayed
  45.  
  46. ------------------------------------------------------------------
  47.  
  48.                     PROCEDURE FORMAT
  49.  
  50. ;testproc.asm     program to test  PROCEDURES
  51. ;will use COM format for program so that size displayed by DIR
  52. ;command is true size of executable assembled code; again must
  53. ;use exe2bin to convert EXE to COM file as in above
  54. ;
  55. ;Start of actual code section
  56. ;
  57. codeseg  segment             ;start of codeseg,pseudo-op
  58. assume   cs:codeseg          ;define code segment pseudo-op
  59.          org       100h      ;required for COM, pseudo-op
  60. ;
  61. begin:                       ;actual excecutable code below
  62.          mov       dl,49     ;pass ASCII chr (1) for CALL, 2 bytes
  63.          call      chrtoscr  ;call is 3 bytes
  64.          call      crlf      ;call is 3 bytes
  65.          mov       dl,50     ;pass ASCII(2) for CALL, 2 bytes
  66.          call      chrtoscr  ;call is 3 bytes
  67. ;
  68. ;total code in this section used is 13 bytes      
  69. ;
  70. ;a good place to put your PROCEDURES that you do not want done in
  71. ;line is below the return to DOS code. They will of course be 'near' 
  72. ;since they are in the same code segment.
  73. ;
  74.          mov       ah,4ch    ;ready to return to DOS , see E-3
  75.          int       21h       ;Manual 2.0, total code here ,4 bytes
  76.                              ;for these two lines
  77. ;
  78. ;PROCEDURES below not done in line
  79. ;
  80. servdos  proc                ;define PROCEDURE 'servdos' for DOS calls
  81.          int       21h       ;must pass function before use,2 bytes
  82.          ret                 ;return to calling location,1 byte
  83. servdos  endp                ;end of procedure,3 bytes to define
  84. ;
  85. crlf     proc                ;carriage return line feed is useful
  86.          mov       dl,13     ;carriage return,2 bytes
  87.          mov       ah,2      ;DOS function 2,2 bytes
  88.          int       21h       ;DOS interrupt,2 bytes
  89.          mov       dl,10     ;line feed,2 bytes
  90.          mov       ah,2      ;same as above, 2 bytes
  91.          int       21h       ;same as above, 2 bytes
  92.          ret                 ;near return,no-pop, 1 byte
  93. crlf     endp                ;end of procedure,13 bytes to define
  94. ;
  95. chrtoscr proc                ;define PROC to send chr to screen
  96.          mov       ah,2      ;function 2, must pass chr in dl,2bytes
  97.          int       21h       ;DOS function, 2 bytes
  98.          ret                 ;return to call place, 1 byte
  99. chrtoscr endp                ;end of procedure, 5 bytes to define
  100. ;
  101. ;total code assembled here in defining PROCEDURES is 21 bytes
  102. ;
  103. codeseg    ends                ;end of codeseg,pseudo-op
  104.         en       e to start,pseudo-op;
  105. ;
  106. ;Fini                         21 bytes used for procedure definitions
  107.                              ;13 bytes for calls and passing data
  108.                              ; 4 bytes for return to DOS
  109. ;38 bytes Total Assembled code of which 3 is in servdos, not used
  110. ;but which appears in total as it is nevertheless assembled
  111. ;
  112.